import indexOf from './indexOf'
import isArrayLike from '../util/isArrayLike'
import { isNumber } from '../util/type'

function include(obj, item, fromIndex, guard) {
  if (isArrayLike(obj)) {
    obj = Object.values(obj)
  }
  if (!isNumber(!fromIndex) || guard) {
    fromIndex = 0
  }
  return indexOf(obj, item, fromIndex) >= 0
}

export default include
